import playground from './playground/playground';
import './index.scss';

declare var require,
    module;

function main() {
    const element = document.createElement('div');
    element.id = 'app';
    loadPage(element, playground);
    return element;
}

function loadPage(element: HTMLElement, pageFunc: () => PageMeta) {
    const page = pageFunc();
    element.innerHTML = page.html;
    setTimeout(() => {
        page.controller.execute();
    });
}

interface PageMeta {
    controller: any;
    html: any;
}

document.body.appendChild(main());

if (module.hot) {
    // debugger;
}